package br.com.pguide.activity;

import br.com.pguide.R;
import br.com.pguide.utils.Mensagem;
import br.com.pguide.webservice.WebService;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class InitialActivity extends Activity {
	
	public static String URL = "http://localhost:8000/";
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContent();
    }
    
    private void setContent(){
        setContentView(R.layout.login);
    }
    
    public void cadastrar(View view) {
    	Intent it = new Intent(this, CadastroUsuarioActivity.class);
    	startActivity(it);
    }
    
    public void entrar(View view) {
    	//String username = ((EditText) findViewById(R.id.edit_email)).getText().toString();
    	//String password = ((EditText) findViewById(R.id.edit_senha)).getText().toString();
    	try {
    		//if (WebService.autenticacao_login(username, password)){
    	    if (WebService.autenticacao_login("alezyoliveira@msn.com", "1")){
    			Intent it = new Intent(this, MainWindowTabActivity.class);
    	    	//it.putExtra("username", username);
    			it.putExtra("username", "alezyoliveira@msn.com");
    	    	
    	    	startActivity(it);
    		} else {
    			Mensagem.exibirToastCurto(getString(R.string.senha_incorreta), this);
			}
		} catch (Exception e) {
			Mensagem.exibirMensagem(e.getMessage(), this);
		}
    }
}